package Practice;

import java.util.Scanner;

public class MagicSquare {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] a = new int[n][n];
        int y = (n-1)/2;
        int x = 0;
        for (int k = 1; k <= n * n; k++) {
            a[x][y] = k;
            if (x==0&&y!=n-1){
                x = n-1;
                y += 1;
            }
            else if (y==n-1&&x!=0){
                y = 0;
                x -= 1;
            }
            else if (x==0&&y==n-1){
                x += 1;
            }
            else {
                if (a[x-1][y+1]==0){
                    x -= 1;
                    y += 1;
                }
                else {
                    x++;
                }
            }
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                System.out.print(a[i][j] + " ");
            }
            System.out.println();
        }
    }
}
